package com.zy.je.common.core.model;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zy
 */
public class MapBuilder<K, V> {
    private final Map<K, V> map = new HashMap<>();

    public static <K, V> MapBuilder<K, V> builder() {
        return new MapBuilder<>();
    }

    public MapBuilder<K, V> put(K key, V value) {
        map.put(key, value);
        return this;
    }

    public Map<K, V> build() {
        // 返回不可变的Map副本
        return new HashMap<>(map);
    }
}